﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class MainPanel : BasePanel
{
	public Button registerBtn;

	public Button loginBtn;
	public Button closeBtn;
	
	
	private void Start()
	{
		registerBtn.onClick.AddListener(delegate { RegisterButtonClicked(); });
		loginBtn.onClick.AddListener(delegate { LoginButtonClicked(); });
		closeBtn.onClick.AddListener(delegate { CloseButtonClicked(); });
	
	}


	private void TestConnectionButtonClicked()
	{
		UnityFacade.Instance.UiManager.PushPanel(PanelType.TestConnectionPanel);
	}

	private void RegisterButtonClicked()
	{
		UnityFacade.Instance.UiManager.PushPanel(PanelType.Register);
	}

	private void LoginButtonClicked()
	{
		UnityFacade.Instance.UiManager.PushPanel(PanelType.Login);
	}

	private void CloseButtonClicked()
	{
		Application.Quit();
	}

	public override void OnEnter()
	{
		Debug.Log("MainPanel加载了");
	}

	public override void OnPause()
	{
//		registerBtn.interactable = false;
//		loginBtn.interactable = false;
//		closeBtn.interactable = false;
		
	}

	public override void OnResume()
	{
//		
//		registerBtn.interactable = true;
//		loginBtn.interactable = true;
//		closeBtn.interactable = true;
	}

	public override void OnExit()
	{
		this.gameObject.SetActive(false);
	}
}
